% Copyright (C) 2009,2010,2011,2012  Marco Restelli
%
% This file is part of:
%   LDGH -- Local Hybridizable Discontinuous Galerkin toolkit
%
% LDGH is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LDGH is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
% License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LDGH. If not, see <http://www.gnu.org/licenses/>.
%
% author: Marco Restelli                   <marco.restelli@gmail.com>


function data = dgcomp_collect_fast_output(infile)
% data = dgcomp_collect_fast_output(infile)

 error('This function is out of date: use collect_fast_output');

 description = load(infile);

 fid = fopen(infile,'r');

 % locate the data section
 delimiter = '#-/DELIMITER\-#';
 delsize = length(delimiter);
 found = 0;
 while(~found)
   line = fgets(fid);
   if(length(line)>=delsize)
     if(strcmp(line(1:delsize),delimiter))
       found = 1;
     end
   end
 end

 i = 0;
 while(line~=-1)
   line = fgets(fid);
   if(line~=-1)
     i = i+1;
     times(i) = sscanf(line,'%f');
     line = fgets(fid);
     uuu(:,:,:,i) = reshape( ...
        sscanf(line,'%f',prod(description.DS)) , description.DS);
   end
 end
 
 fclose(fid);

 data.ie = description.ie_fop;
 data.times = times;
 data.uuu = uuu;

return
